/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * CadastrarAluno.java
 *
 * Created on 12/06/2009, 19:38:22
 */
package Negocios;

import java.awt.Component;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import java.sql.ResultSet;
import java.util.Date;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JCheckBox;
import javax.swing.JTextField;

/**
 *
 * @author Administrador
 */
public class CadastrarAluno extends javax.swing.JInternalFrame {

    public int anoinicio = 0, anofim = 0, inicioCurso = 0;
    public boolean Insert = false;
    public java.sql.Connection OracleCon;
    public int dia = 0, mes = 0, ano = 0;
    ResultSet rs = null;

    /** Creates new form CadastrarAluno */
    public CadastrarAluno() {
        initComponents();



        Date data = new Date();
        anoinicio = (1900 + (data.getYear() - 59));
        anofim = (1900 + (data.getYear() - 15));
        inicioCurso = (1900 + (data.getYear()));

        for (int x = anofim; x > anoinicio; x--) {
            AnojComboBox.addItem(x);
        }

    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroup1 = new javax.swing.ButtonGroup();
        buttonGroup2 = new javax.swing.ButtonGroup();
        buttonGroup3 = new javax.swing.ButtonGroup();
        buttonGroup4 = new javax.swing.ButtonGroup();
        EditarjButton = new javax.swing.JButton();
        CadastrarjButton2 = new javax.swing.JButton();
        ExcluirjButton = new javax.swing.JButton();
        AvisojLabel = new javax.swing.JLabel();
        DadosPessoaisjPanel = new javax.swing.JPanel();
        RMjLabel = new javax.swing.JLabel();
        NomejLabel = new javax.swing.JLabel();
        EstadoMatriculajLabel = new javax.swing.JLabel();
        DataNascimentojPanel = new javax.swing.JPanel();
        DiaDataNascimentojLabel = new javax.swing.JLabel();
        MesDataNacimentojLabel = new javax.swing.JLabel();
        AnoDataNascimentojLabel = new javax.swing.JLabel();
        DiajComboBox = new javax.swing.JComboBox();
        MesjComboBox = new javax.swing.JComboBox();
        AnojComboBox = new javax.swing.JComboBox();
        SexojPanel = new javax.swing.JPanel();
        MasculinojRadioButton = new javax.swing.JRadioButton();
        FemininojRadioButton = new javax.swing.JRadioButton();
        EntidadejPanel = new javax.swing.JPanel();
        FatecjRadioButton = new javax.swing.JRadioButton();
        EtecjRadioButton = new javax.swing.JRadioButton();
        DataIngressojPanel = new javax.swing.JPanel();
        SemestreIngressojLabel = new javax.swing.JLabel();
        SemestreIngresso1jRadioButton = new javax.swing.JRadioButton();
        SemestreIngresso2jRadioButton = new javax.swing.JRadioButton();
        AnoIngressojLabel = new javax.swing.JLabel();
        AnoIngressojComboBox = new javax.swing.JComboBox();
        CursojPanel = new javax.swing.JPanel();
        CursojComboBox = new javax.swing.JComboBox();
        EstadoMatriculaAtivajRadioButton = new javax.swing.JRadioButton();
        EstadoMatriculaInativajRadioButton = new javax.swing.JRadioButton();
        IdadeCalculadajLabel = new javax.swing.JLabel();
        nomeJtextField = new javax.swing.JFormattedTextField();
        RMjFormattedTextField = new javax.swing.JFormattedTextField();
        PainelEndereçojPanel = new javax.swing.JPanel();
        EndereçojLabel = new javax.swing.JLabel();
        EndereçojTextField = new javax.swing.JTextField();
        BairrojLabel = new javax.swing.JLabel();
        BairrojTextField = new javax.swing.JTextField();
        CidadejLabel = new javax.swing.JLabel();
        CidadejTextField = new javax.swing.JTextField();
        TelefonejPanel = new javax.swing.JPanel();
        ResidencialjLabel = new javax.swing.JLabel();
        ResidenciajFormattedTextField = new javax.swing.JFormattedTextField();
        CelularjLabel = new javax.swing.JLabel();
        CelularjFormattedTextField = new javax.swing.JFormattedTextField();
        dddresComboBox = new javax.swing.JComboBox();
        dddCelCombobox = new javax.swing.JComboBox();
        PerfilEsportistajPanel = new javax.swing.JPanel();
        FutebolDeSalãojCheckBox = new javax.swing.JCheckBox();
        FutebolSocietyjCheckBox = new javax.swing.JCheckBox();
        FutebolDePraiajCheckBox = new javax.swing.JCheckBox();
        BasquetejCheckBox = new javax.swing.JCheckBox();
        VoleijCheckBox = new javax.swing.JCheckBox();
        HandeboljCheckBox = new javax.swing.JCheckBox();
        AtletismojCheckBox = new javax.swing.JCheckBox();
        XadrezjCheckBox = new javax.swing.JCheckBox();
        DamasjCheckBox = new javax.swing.JCheckBox();
        TenisDeMesajCheckBox = new javax.swing.JCheckBox();
        DançaDeSalãojCheckBox = new javax.swing.JCheckBox();
        SinucajCheckBox = new javax.swing.JCheckBox();
        TrucojCheckBox = new javax.swing.JCheckBox();
        QueimadajCheckBox = new javax.swing.JCheckBox();
        ModalidadeQuePraticajLabel = new javax.swing.JLabel();

        setClosable(true);
        setDefaultCloseOperation(javax.swing.WindowConstants.HIDE_ON_CLOSE);
        setIconifiable(true);
        setTitle("Cadastrar Aluno");
        addInternalFrameListener(new javax.swing.event.InternalFrameListener() {
            public void internalFrameActivated(javax.swing.event.InternalFrameEvent evt) {
            }
            public void internalFrameClosed(javax.swing.event.InternalFrameEvent evt) {
                formInternalFrameClosed(evt);
            }
            public void internalFrameClosing(javax.swing.event.InternalFrameEvent evt) {
            }
            public void internalFrameDeactivated(javax.swing.event.InternalFrameEvent evt) {
            }
            public void internalFrameDeiconified(javax.swing.event.InternalFrameEvent evt) {
            }
            public void internalFrameIconified(javax.swing.event.InternalFrameEvent evt) {
            }
            public void internalFrameOpened(javax.swing.event.InternalFrameEvent evt) {
                formInternalFrameOpened(evt);
            }
        });

        EditarjButton.setText("Editar");
        EditarjButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                EditarjButtonActionPerformed(evt);
            }
        });

        CadastrarjButton2.setText("Cadastrar");
        CadastrarjButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                CadastrarjButton2ActionPerformed(evt);
            }
        });

        ExcluirjButton.setText("Excluir");

        AvisojLabel.setText("* Preencha todos os campos dos Dados Pessoais");

        DadosPessoaisjPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Dados Pessoais"));

        RMjLabel.setText("RM ");

        NomejLabel.setText("Nome Completo ");

        EstadoMatriculajLabel.setText("Estado da Matricula");

        DataNascimentojPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Data de Nascimento"));

        DiaDataNascimentojLabel.setText("Dia");

        MesDataNacimentojLabel.setText("Mês");

        AnoDataNascimentojLabel.setText("Ano");

        DiajComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31" }));
        DiajComboBox.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                DiajComboBoxMouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                DiajComboBoxMouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                DiajComboBoxMouseExited(evt);
            }
            public void mousePressed(java.awt.event.MouseEvent evt) {
                DiajComboBoxMousePressed(evt);
            }
            public void mouseReleased(java.awt.event.MouseEvent evt) {
                DiajComboBoxMouseReleased(evt);
            }
        });
        DiajComboBox.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                DiajComboBoxActionPerformed(evt);
            }
        });
        DiajComboBox.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                DiajComboBoxFocusLost(evt);
            }
        });

        MesjComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12" }));
        MesjComboBox.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                MesjComboBoxActionPerformed(evt);
            }
        });

        AnojComboBox.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                AnojComboBoxActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout DataNascimentojPanelLayout = new javax.swing.GroupLayout(DataNascimentojPanel);
        DataNascimentojPanel.setLayout(DataNascimentojPanelLayout);
        DataNascimentojPanelLayout.setHorizontalGroup(
            DataNascimentojPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(DataNascimentojPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(DiaDataNascimentojLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(DiajComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 44, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(MesDataNacimentojLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(MesjComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 44, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(AnoDataNascimentojLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(AnojComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(23, Short.MAX_VALUE))
        );
        DataNascimentojPanelLayout.setVerticalGroup(
            DataNascimentojPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(DataNascimentojPanelLayout.createSequentialGroup()
                .addGroup(DataNascimentojPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(DiaDataNascimentojLabel)
                    .addComponent(DiajComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(MesDataNacimentojLabel)
                    .addComponent(MesjComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(AnoDataNascimentojLabel)
                    .addComponent(AnojComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        SexojPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Sexo"));

        buttonGroup4.add(MasculinojRadioButton);
        MasculinojRadioButton.setText("Masculino");
        MasculinojRadioButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                MasculinojRadioButtonActionPerformed(evt);
            }
        });

        buttonGroup4.add(FemininojRadioButton);
        FemininojRadioButton.setText("Feminino");

        javax.swing.GroupLayout SexojPanelLayout = new javax.swing.GroupLayout(SexojPanel);
        SexojPanel.setLayout(SexojPanelLayout);
        SexojPanelLayout.setHorizontalGroup(
            SexojPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(SexojPanelLayout.createSequentialGroup()
                .addComponent(MasculinojRadioButton)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(FemininojRadioButton)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        SexojPanelLayout.setVerticalGroup(
            SexojPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(SexojPanelLayout.createSequentialGroup()
                .addGroup(SexojPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(MasculinojRadioButton)
                    .addComponent(FemininojRadioButton))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        EntidadejPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Entidade de Ensino"));

        buttonGroup1.add(FatecjRadioButton);
        FatecjRadioButton.setText("FATEC");
        FatecjRadioButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                FatecjRadioButtonActionPerformed(evt);
            }
        });

        buttonGroup1.add(EtecjRadioButton);
        EtecjRadioButton.setText("ETEC");
        EtecjRadioButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                EtecjRadioButtonActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout EntidadejPanelLayout = new javax.swing.GroupLayout(EntidadejPanel);
        EntidadejPanel.setLayout(EntidadejPanelLayout);
        EntidadejPanelLayout.setHorizontalGroup(
            EntidadejPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(EntidadejPanelLayout.createSequentialGroup()
                .addComponent(FatecjRadioButton)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(EtecjRadioButton)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        EntidadejPanelLayout.setVerticalGroup(
            EntidadejPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(EntidadejPanelLayout.createSequentialGroup()
                .addGroup(EntidadejPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(FatecjRadioButton)
                    .addComponent(EtecjRadioButton))
                .addContainerGap(8, Short.MAX_VALUE))
        );

        DataIngressojPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Data de Ingresso"));

        SemestreIngressojLabel.setText("Semestre");

        buttonGroup2.add(SemestreIngresso1jRadioButton);
        SemestreIngresso1jRadioButton.setText("1º");
        SemestreIngresso1jRadioButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                SemestreIngresso1jRadioButtonActionPerformed(evt);
            }
        });

        buttonGroup2.add(SemestreIngresso2jRadioButton);
        SemestreIngresso2jRadioButton.setText("2º");

        AnoIngressojLabel.setText("Ano");

        AnoIngressojComboBox.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                AnoIngressojComboBoxActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout DataIngressojPanelLayout = new javax.swing.GroupLayout(DataIngressojPanel);
        DataIngressojPanel.setLayout(DataIngressojPanelLayout);
        DataIngressojPanelLayout.setHorizontalGroup(
            DataIngressojPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(DataIngressojPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(SemestreIngressojLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(SemestreIngresso1jRadioButton)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(SemestreIngresso2jRadioButton)
                .addGap(18, 18, 18)
                .addComponent(AnoIngressojLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(AnoIngressojComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        DataIngressojPanelLayout.setVerticalGroup(
            DataIngressojPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(DataIngressojPanelLayout.createSequentialGroup()
                .addGroup(DataIngressojPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(SemestreIngressojLabel)
                    .addComponent(SemestreIngresso1jRadioButton)
                    .addComponent(SemestreIngresso2jRadioButton)
                    .addComponent(AnoIngressojLabel)
                    .addComponent(AnoIngressojComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        CursojPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Curso"));

        CursojComboBox.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                CursojComboBoxActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout CursojPanelLayout = new javax.swing.GroupLayout(CursojPanel);
        CursojPanel.setLayout(CursojPanelLayout);
        CursojPanelLayout.setHorizontalGroup(
            CursojPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(CursojPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(CursojComboBox, 0, 384, Short.MAX_VALUE)
                .addContainerGap())
        );
        CursojPanelLayout.setVerticalGroup(
            CursojPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(CursojPanelLayout.createSequentialGroup()
                .addComponent(CursojComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        buttonGroup3.add(EstadoMatriculaAtivajRadioButton);
        EstadoMatriculaAtivajRadioButton.setText("Ativa");
        EstadoMatriculaAtivajRadioButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                EstadoMatriculaAtivajRadioButtonActionPerformed(evt);
            }
        });

        buttonGroup3.add(EstadoMatriculaInativajRadioButton);
        EstadoMatriculaInativajRadioButton.setText("Inativa");

        nomeJtextField.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                nomeJtextFieldFocusLost(evt);
            }
        });
        nomeJtextField.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                nomeJtextFieldKeyPressed(evt);
            }
            public void keyTyped(java.awt.event.KeyEvent evt) {
                nomeJtextFieldKeyTyped(evt);
            }
        });

        try {
            RMjFormattedTextField.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("#######")));
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }

        javax.swing.GroupLayout DadosPessoaisjPanelLayout = new javax.swing.GroupLayout(DadosPessoaisjPanel);
        DadosPessoaisjPanel.setLayout(DadosPessoaisjPanelLayout);
        DadosPessoaisjPanelLayout.setHorizontalGroup(
            DadosPessoaisjPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(DadosPessoaisjPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(DadosPessoaisjPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(DadosPessoaisjPanelLayout.createSequentialGroup()
                        .addComponent(DataNascimentojPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGroup(DadosPessoaisjPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(DadosPessoaisjPanelLayout.createSequentialGroup()
                                .addGap(168, 168, 168)
                                .addComponent(IdadeCalculadajLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(DadosPessoaisjPanelLayout.createSequentialGroup()
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(SexojPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(EstadoMatriculajLabel)
                                .addGap(18, 18, 18)
                                .addGroup(DadosPessoaisjPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(EstadoMatriculaInativajRadioButton)
                                    .addComponent(EstadoMatriculaAtivajRadioButton)))))
                    .addGroup(DadosPessoaisjPanelLayout.createSequentialGroup()
                        .addGroup(DadosPessoaisjPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, DadosPessoaisjPanelLayout.createSequentialGroup()
                                .addComponent(RMjLabel)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(RMjFormattedTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(EntidadejPanel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGroup(DadosPessoaisjPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(DadosPessoaisjPanelLayout.createSequentialGroup()
                                .addGap(6, 6, 6)
                                .addComponent(CursojPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(DataIngressojPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(DadosPessoaisjPanelLayout.createSequentialGroup()
                                .addGap(16, 16, 16)
                                .addComponent(NomejLabel)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(nomeJtextField, javax.swing.GroupLayout.PREFERRED_SIZE, 477, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                .addGap(20, 20, 20))
        );
        DadosPessoaisjPanelLayout.setVerticalGroup(
            DadosPessoaisjPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(DadosPessoaisjPanelLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(DadosPessoaisjPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(RMjLabel)
                    .addComponent(RMjFormattedTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(NomejLabel)
                    .addComponent(nomeJtextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(DadosPessoaisjPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(DadosPessoaisjPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                        .addComponent(CursojPanel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(EntidadejPanel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addComponent(DataIngressojPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(DadosPessoaisjPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(DadosPessoaisjPanelLayout.createSequentialGroup()
                        .addGap(9, 9, 9)
                        .addGroup(DadosPessoaisjPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(EstadoMatriculajLabel, javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(EstadoMatriculaAtivajRadioButton, javax.swing.GroupLayout.Alignment.TRAILING))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(EstadoMatriculaInativajRadioButton)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(IdadeCalculadajLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(DataNascimentojPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(SexojPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)))
        );

        PainelEndereçojPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Endereço / Contato"));

        EndereçojLabel.setText("Endereço");

        BairrojLabel.setText("Bairro");

        CidadejLabel.setText("Cidade");

        TelefonejPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Telefone"));

        ResidencialjLabel.setText("Residencial");

        try {
            ResidenciajFormattedTextField.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("#### ####")));
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }

        CelularjLabel.setText("Celular");

        try {
            CelularjFormattedTextField.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("#### ####")));
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }

        dddresComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "13", "11", "12" }));

        dddCelCombobox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "13", "11", "12" }));

        javax.swing.GroupLayout TelefonejPanelLayout = new javax.swing.GroupLayout(TelefonejPanel);
        TelefonejPanel.setLayout(TelefonejPanelLayout);
        TelefonejPanelLayout.setHorizontalGroup(
            TelefonejPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(TelefonejPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(ResidencialjLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(dddresComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 44, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(ResidenciajFormattedTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(CelularjLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 9, Short.MAX_VALUE)
                .addComponent(dddCelCombobox, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(CelularjFormattedTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 115, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        TelefonejPanelLayout.setVerticalGroup(
            TelefonejPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(TelefonejPanelLayout.createSequentialGroup()
                .addGroup(TelefonejPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(ResidencialjLabel)
                    .addComponent(dddCelCombobox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(CelularjLabel)
                    .addComponent(ResidenciajFormattedTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(dddresComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(CelularjFormattedTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout PainelEndereçojPanelLayout = new javax.swing.GroupLayout(PainelEndereçojPanel);
        PainelEndereçojPanel.setLayout(PainelEndereçojPanelLayout);
        PainelEndereçojPanelLayout.setHorizontalGroup(
            PainelEndereçojPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(PainelEndereçojPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(PainelEndereçojPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(TelefonejPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(PainelEndereçojPanelLayout.createSequentialGroup()
                        .addComponent(EndereçojLabel)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(EndereçojTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 293, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(BairrojLabel)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(BairrojTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 173, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(CidadejLabel)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(CidadejTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 122, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(91, Short.MAX_VALUE))
        );
        PainelEndereçojPanelLayout.setVerticalGroup(
            PainelEndereçojPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(PainelEndereçojPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(PainelEndereçojPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(EndereçojLabel)
                    .addComponent(EndereçojTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(BairrojLabel)
                    .addComponent(BairrojTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(CidadejLabel)
                    .addComponent(CidadejTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(TelefonejPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        PerfilEsportistajPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Perfil Esportista"));

        FutebolDeSalãojCheckBox.setText("Futebol de Salão");

        FutebolSocietyjCheckBox.setText("Futebol Society");

        FutebolDePraiajCheckBox.setText("Futebol de Praia");

        BasquetejCheckBox.setText("Basquete");

        VoleijCheckBox.setText("Volei");

        HandeboljCheckBox.setText("Handebol");

        AtletismojCheckBox.setText("Atletismo");

        XadrezjCheckBox.setText("Xadrez");

        DamasjCheckBox.setText("Damas");

        TenisDeMesajCheckBox.setText("Tenis de Mesa");

        DançaDeSalãojCheckBox.setText("Dança de Salão");

        SinucajCheckBox.setText("Sinuca");

        TrucojCheckBox.setText("Truco");

        QueimadajCheckBox.setText("Queimada");

        ModalidadeQuePraticajLabel.setText("Modalidades que pratica ou gostaria de praticar");

        javax.swing.GroupLayout PerfilEsportistajPanelLayout = new javax.swing.GroupLayout(PerfilEsportistajPanel);
        PerfilEsportistajPanel.setLayout(PerfilEsportistajPanelLayout);
        PerfilEsportistajPanelLayout.setHorizontalGroup(
            PerfilEsportistajPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(PerfilEsportistajPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(PerfilEsportistajPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(PerfilEsportistajPanelLayout.createSequentialGroup()
                        .addGroup(PerfilEsportistajPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, PerfilEsportistajPanelLayout.createSequentialGroup()
                                .addComponent(FutebolDeSalãojCheckBox)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(FutebolSocietyjCheckBox))
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, PerfilEsportistajPanelLayout.createSequentialGroup()
                                .addGap(2, 2, 2)
                                .addComponent(XadrezjCheckBox)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(DamasjCheckBox)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(TenisDeMesajCheckBox)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(PerfilEsportistajPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(PerfilEsportistajPanelLayout.createSequentialGroup()
                                .addComponent(FutebolDePraiajCheckBox)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(BasquetejCheckBox)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(VoleijCheckBox)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(HandeboljCheckBox)
                                .addGap(6, 6, 6)
                                .addComponent(AtletismojCheckBox))
                            .addGroup(PerfilEsportistajPanelLayout.createSequentialGroup()
                                .addComponent(DançaDeSalãojCheckBox)
                                .addGap(4, 4, 4)
                                .addComponent(SinucajCheckBox)
                                .addGap(18, 18, 18)
                                .addComponent(TrucojCheckBox)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(QueimadajCheckBox))))
                    .addComponent(ModalidadeQuePraticajLabel))
                .addContainerGap(239, Short.MAX_VALUE))
        );
        PerfilEsportistajPanelLayout.setVerticalGroup(
            PerfilEsportistajPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(PerfilEsportistajPanelLayout.createSequentialGroup()
                .addGap(5, 5, 5)
                .addComponent(ModalidadeQuePraticajLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(PerfilEsportistajPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(FutebolDeSalãojCheckBox)
                    .addComponent(FutebolSocietyjCheckBox)
                    .addComponent(FutebolDePraiajCheckBox)
                    .addComponent(BasquetejCheckBox)
                    .addComponent(VoleijCheckBox)
                    .addComponent(HandeboljCheckBox)
                    .addComponent(AtletismojCheckBox))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(PerfilEsportistajPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(XadrezjCheckBox)
                    .addComponent(DamasjCheckBox)
                    .addComponent(TenisDeMesajCheckBox)
                    .addComponent(DançaDeSalãojCheckBox)
                    .addComponent(SinucajCheckBox)
                    .addComponent(TrucojCheckBox)
                    .addComponent(QueimadajCheckBox))
                .addContainerGap(10, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(AvisojLabel)
                            .addComponent(PainelEndereçojPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(PerfilEsportistajPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addContainerGap())
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addComponent(CadastrarjButton2)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(EditarjButton)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(ExcluirjButton)
                        .addGap(25, 25, 25))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(DadosPessoaisjPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 855, Short.MAX_VALUE)
                        .addContainerGap())))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(DadosPessoaisjPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(29, 29, 29)
                .addComponent(AvisojLabel)
                .addGap(18, 18, 18)
                .addComponent(PainelEndereçojPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(PerfilEsportistajPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(28, 28, 28)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(ExcluirjButton)
                    .addComponent(EditarjButton)
                    .addComponent(CadastrarjButton2))
                .addContainerGap(70, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void CadastrarjButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CadastrarjButton2ActionPerformed

        int Entidade = 0;

        if (FatecjRadioButton.isSelected()) {
            Entidade = 1;
        }
        if (EtecjRadioButton.isSelected()) {
            Entidade = 2;
        }

        int Curso = 0;

         String sql1 = "Select cd_curso from curso where nm_curso like '" +
               CursojComboBox.getSelectedItem()+ "'";
        try {
          rs =  Conexão.conexãoJDBC.createStatement().executeQuery(sql1);
            while (rs.next()){
                Curso = rs.getInt("cd_curso");


            }
        } catch (SQLException ex) {
            JOptionPane.showMessageDialog(null, " Erro ao pesquisar código do curso");
        }

        int Semestre = 0;
        if (SemestreIngresso1jRadioButton.isSelected()) {
            Semestre = 1;
        }
        if (SemestreIngresso2jRadioButton.isSelected()) {
            Semestre = 2;
        }

        String MatriculaEst = "";
        if (EstadoMatriculaAtivajRadioButton.isSelected()) {
            MatriculaEst = "Ativa";
        }
        if (EstadoMatriculaInativajRadioButton.isSelected()) {
            MatriculaEst = "Inativa";
        }

        String Sexo = "";
        if (MasculinojRadioButton.isSelected()) {
            Sexo = "M";
        }
        if (FemininojRadioButton.isSelected()) {
            Sexo = "F";
        }


        int rm = (Integer.parseInt((RMjFormattedTextField.getText())));
        String nome = nomeJtextField.getText();
        int entidade = Entidade;
        int curso = Curso;
        int anoIngresso =  (Integer.parseInt((String) AnoIngressojComboBox.getSelectedItem()));
        int SemestreIngresso = Semestre;
        String EstadoMatricula = MatriculaEst;
        String DiaNascimento = (String) (DiajComboBox.getSelectedItem());
        String MesNascimento = (String) (MesjComboBox.getSelectedItem());
        String AnoNascimento = (String) (AnojComboBox.getSelectedItem());
        String DataNascimento = (AnoNascimento + "/" + MesNascimento + "/" + DiaNascimento);
        String sexo = Sexo;
        String endereço = EndereçojTextField.getText();
        String bairro = BairrojTextField.getText();
        String cidade = CidadejTextField.getText();
        int dddres = (Integer.parseInt((String) dddresComboBox.getSelectedItem()));
        int telresidencial = Integer.parseInt(ResidenciajFormattedTextField.getText());
        int dddcel = (Integer.parseInt((String) dddCelCombobox.getSelectedItem()));
        int telcelular = Integer.parseInt (CelularjFormattedTextField.getText());



        if (endereço.equals("")) {
            endereço = null;
        }

        if (bairro.equals("")) {
            bairro = null;
        }

        if (cidade.equals("")) {
            cidade = null;
        }

        if (telresidencial == 0) {
            telresidencial = 0;
        }

        if (telcelular == 0) {
            telcelular = 0;
        }





        String SQL = "INSERT INTO hr.aluno VALUES(" + rm + ",'" + nome + "','" + DataNascimento + "','" + sexo + "','" + endereço + "','" + bairro + "','" + cidade + "'," + dddres + "," + telresidencial + "," + dddcel + "," +telcelular + "," + SemestreIngresso + "," + anoIngresso + ",'" + EstadoMatricula + "'," + curso + ")";

        System.out.println("sql: " + SQL);
        try {
            Conexão.conexãoJDBC.createStatement().execute(SQL);
            JOptionPane.showMessageDialog(this, "Cadastro inserido com sucesso", "Cadastro Aluno", JOptionPane.INFORMATION_MESSAGE);
            this.dispose();
        } catch (SQLException ex) {
            JOptionPane.showMessageDialog(this, "O registro não pode ser inserido.Erro: " + ex.getMessage(),
                    "Erro",
                    JOptionPane.ERROR_MESSAGE);


        }

        int cd_perfil = 0;
        for (Component c : PerfilEsportistajPanel.getComponents()) {
            if (c.getClass() == JCheckBox.class) {
                JCheckBox check = (JCheckBox) c;
                cd_perfil++;
                if (check.isSelected()) {
                     String SQL2 = "INSERT INTO hr.perfil_esportista_has_aluno VALUES(" + cd_perfil + ",'" + rm +  ")";

                     System.out.println("sql: " + SQL2);
                try {
                     Conexão.conexãoJDBC.createStatement().execute(SQL2);
                     JOptionPane.showMessageDialog(this, "Cadastro inserido com sucesso", "Cadastro Perfil Esportista do Aluno", JOptionPane.INFORMATION_MESSAGE);
                     this.dispose();
                } catch (SQLException ex) {
                     JOptionPane.showMessageDialog(this, "O registro não pode ser inserido.Erro: " + ex.getMessage(),
                     "Erro",
                     JOptionPane.ERROR_MESSAGE);
                }
            }
        }
    }
}//GEN-LAST:event_CadastrarjButton2ActionPerformed

    private void EditarjButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_EditarjButtonActionPerformed

     
}//GEN-LAST:event_EditarjButtonActionPerformed

    private void MasculinojRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MasculinojRadioButtonActionPerformed
    }//GEN-LAST:event_MasculinojRadioButtonActionPerformed

    private void FatecjRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_FatecjRadioButtonActionPerformed
        try {
            String SQL = "Select nm_curso from Curso where cd_entidade_ensino = 1";
            CursojComboBox.removeAllItems();

            rs = Conexão.conexãoJDBC.createStatement().executeQuery(SQL);
            DefaultComboBoxModel model = (DefaultComboBoxModel) CursojComboBox.getModel();
            CursojComboBox.removeAllItems();
            while (rs.next()) {
                CursojComboBox.addItem(rs.getString("nm_curso"));
            }
        } catch (SQLException ex) {
            Logger.getLogger(CadastrarAluno.class.getName()).log(Level.SEVERE, null, ex);
        }

        AnoIngressojComboBox.removeAllItems();
        for (int x = inicioCurso; x >= 2005; x--) {
            AnoIngressojComboBox.addItem(x);
        }






    }//GEN-LAST:event_FatecjRadioButtonActionPerformed

    private void EtecjRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_EtecjRadioButtonActionPerformed

        try {
            String SQL = "Select nm_curso from Curso where cd_entidade_ensino = 2";
            CursojComboBox.removeAllItems();

            rs = Conexão.conexãoJDBC.createStatement().executeQuery(SQL);
            DefaultComboBoxModel model = (DefaultComboBoxModel) CursojComboBox.getModel();
            CursojComboBox.removeAllItems();
            while (rs.next()) {
                CursojComboBox.addItem(rs.getString("nm_curso"));
            }
        } catch (SQLException ex) {
            Logger.getLogger(CadastrarAluno.class.getName()).log(Level.SEVERE, null, ex);
        }

        AnoIngressojComboBox.removeAllItems();
        for (int x = inicioCurso; x >= 2002; x--) {
            AnoIngressojComboBox.addItem(x);
        }
}//GEN-LAST:event_EtecjRadioButtonActionPerformed

    private void SemestreIngresso1jRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SemestreIngresso1jRadioButtonActionPerformed
        int Semestre = 0 ;
        if (SemestreIngresso1jRadioButton.isEnabled()) {
            Semestre = 1;
        } else {
            Semestre = 2;

        }
}//GEN-LAST:event_SemestreIngresso1jRadioButtonActionPerformed

    private void CursojComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CursojComboBoxActionPerformed
    }//GEN-LAST:event_CursojComboBoxActionPerformed

    private void EstadoMatriculaAtivajRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_EstadoMatriculaAtivajRadioButtonActionPerformed
    }//GEN-LAST:event_EstadoMatriculaAtivajRadioButtonActionPerformed

    private void formInternalFrameOpened(javax.swing.event.InternalFrameEvent evt) {//GEN-FIRST:event_formInternalFrameOpened
    }//GEN-LAST:event_formInternalFrameOpened

    private void formInternalFrameClosed(javax.swing.event.InternalFrameEvent evt) {//GEN-FIRST:event_formInternalFrameClosed
    }//GEN-LAST:event_formInternalFrameClosed

    private void DiajComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_DiajComboBoxActionPerformed

        dia = (Integer.parseInt((String) DiajComboBox.getSelectedItem()));

        if (dia == 31) {
            MesjComboBox.removeAllItems();
            MesjComboBox.addItem(01);
            MesjComboBox.addItem(03);
            MesjComboBox.addItem(05);
            MesjComboBox.addItem(07);
            MesjComboBox.addItem("08");
            MesjComboBox.addItem(10);
            MesjComboBox.addItem(12);

        } else if (dia == 30) {
            MesjComboBox.removeAllItems();
            MesjComboBox.addItem(01);
            MesjComboBox.addItem(03);
            MesjComboBox.addItem(04);
            MesjComboBox.addItem(05);
            MesjComboBox.addItem(06);
            MesjComboBox.addItem(07);
            MesjComboBox.addItem("08");
            MesjComboBox.addItem("09");
            MesjComboBox.addItem(10);
            MesjComboBox.addItem(11);
            MesjComboBox.addItem(12);

        } else {
            MesjComboBox.removeAllItems();
            MesjComboBox.addItem(01);
            MesjComboBox.addItem(02);
            MesjComboBox.addItem(03);
            MesjComboBox.addItem(04);
            MesjComboBox.addItem(05);
            MesjComboBox.addItem(06);
            MesjComboBox.addItem(07);
            MesjComboBox.addItem("08");
            MesjComboBox.addItem("09");
            MesjComboBox.addItem(10);
            MesjComboBox.addItem(11);
            MesjComboBox.addItem(12);
        }

    }//GEN-LAST:event_DiajComboBoxActionPerformed

    private void MesjComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MesjComboBoxActionPerformed
    
    }//GEN-LAST:event_MesjComboBoxActionPerformed

    private void AnojComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AnojComboBoxActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_AnojComboBoxActionPerformed

    public void toUpper(JTextField jt) {
        String s = jt.getText().toUpperCase();
        jt.setText(s);
    }

    private void nomeJtextFieldKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_nomeJtextFieldKeyTyped
        toUpper(nomeJtextField);
    }//GEN-LAST:event_nomeJtextFieldKeyTyped

    private void nomeJtextFieldKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_nomeJtextFieldKeyPressed
    }//GEN-LAST:event_nomeJtextFieldKeyPressed

    private void nomeJtextFieldFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_nomeJtextFieldFocusLost
        toUpper(nomeJtextField);
    }//GEN-LAST:event_nomeJtextFieldFocusLost

    private void AnoIngressojComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AnoIngressojComboBoxActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_AnoIngressojComboBoxActionPerformed

    private void DiajComboBoxFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_DiajComboBoxFocusLost
    }//GEN-LAST:event_DiajComboBoxFocusLost

    private void DiajComboBoxMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_DiajComboBoxMouseClicked
        // TODO add your handling code here:
    }//GEN-LAST:event_DiajComboBoxMouseClicked

    private void DiajComboBoxMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_DiajComboBoxMouseEntered
        // TODO add your handling code here:
    }//GEN-LAST:event_DiajComboBoxMouseEntered

    private void DiajComboBoxMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_DiajComboBoxMouseExited
        // TODO add your handling code here:
    }//GEN-LAST:event_DiajComboBoxMouseExited

    private void DiajComboBoxMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_DiajComboBoxMousePressed
        // TODO add your handling code here:
    }//GEN-LAST:event_DiajComboBoxMousePressed

    private void DiajComboBoxMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_DiajComboBoxMouseReleased
     
       
    }//GEN-LAST:event_DiajComboBoxMouseReleased
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel AnoDataNascimentojLabel;
    private javax.swing.JComboBox AnoIngressojComboBox;
    private javax.swing.JLabel AnoIngressojLabel;
    private javax.swing.JComboBox AnojComboBox;
    private javax.swing.JCheckBox AtletismojCheckBox;
    private javax.swing.JLabel AvisojLabel;
    private javax.swing.JLabel BairrojLabel;
    private javax.swing.JTextField BairrojTextField;
    private javax.swing.JCheckBox BasquetejCheckBox;
    private javax.swing.JButton CadastrarjButton2;
    private javax.swing.JFormattedTextField CelularjFormattedTextField;
    private javax.swing.JLabel CelularjLabel;
    private javax.swing.JLabel CidadejLabel;
    private javax.swing.JTextField CidadejTextField;
    private javax.swing.JComboBox CursojComboBox;
    private javax.swing.JPanel CursojPanel;
    private javax.swing.JPanel DadosPessoaisjPanel;
    private javax.swing.JCheckBox DamasjCheckBox;
    private javax.swing.JCheckBox DançaDeSalãojCheckBox;
    private javax.swing.JPanel DataIngressojPanel;
    private javax.swing.JPanel DataNascimentojPanel;
    private javax.swing.JLabel DiaDataNascimentojLabel;
    private javax.swing.JComboBox DiajComboBox;
    private javax.swing.JButton EditarjButton;
    private javax.swing.JLabel EndereçojLabel;
    private javax.swing.JTextField EndereçojTextField;
    private javax.swing.JPanel EntidadejPanel;
    private javax.swing.JRadioButton EstadoMatriculaAtivajRadioButton;
    private javax.swing.JRadioButton EstadoMatriculaInativajRadioButton;
    private javax.swing.JLabel EstadoMatriculajLabel;
    private javax.swing.JRadioButton EtecjRadioButton;
    private javax.swing.JButton ExcluirjButton;
    private javax.swing.JRadioButton FatecjRadioButton;
    private javax.swing.JRadioButton FemininojRadioButton;
    private javax.swing.JCheckBox FutebolDePraiajCheckBox;
    private javax.swing.JCheckBox FutebolDeSalãojCheckBox;
    private javax.swing.JCheckBox FutebolSocietyjCheckBox;
    private javax.swing.JCheckBox HandeboljCheckBox;
    private javax.swing.JLabel IdadeCalculadajLabel;
    private javax.swing.JRadioButton MasculinojRadioButton;
    private javax.swing.JLabel MesDataNacimentojLabel;
    private javax.swing.JComboBox MesjComboBox;
    private javax.swing.JLabel ModalidadeQuePraticajLabel;
    private javax.swing.JLabel NomejLabel;
    private javax.swing.JPanel PainelEndereçojPanel;
    private javax.swing.JPanel PerfilEsportistajPanel;
    private javax.swing.JCheckBox QueimadajCheckBox;
    private javax.swing.JFormattedTextField RMjFormattedTextField;
    private javax.swing.JLabel RMjLabel;
    private javax.swing.JFormattedTextField ResidenciajFormattedTextField;
    private javax.swing.JLabel ResidencialjLabel;
    private javax.swing.JRadioButton SemestreIngresso1jRadioButton;
    private javax.swing.JRadioButton SemestreIngresso2jRadioButton;
    private javax.swing.JLabel SemestreIngressojLabel;
    private javax.swing.JPanel SexojPanel;
    private javax.swing.JCheckBox SinucajCheckBox;
    private javax.swing.JPanel TelefonejPanel;
    private javax.swing.JCheckBox TenisDeMesajCheckBox;
    private javax.swing.JCheckBox TrucojCheckBox;
    private javax.swing.JCheckBox VoleijCheckBox;
    private javax.swing.JCheckBox XadrezjCheckBox;
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.ButtonGroup buttonGroup2;
    private javax.swing.ButtonGroup buttonGroup3;
    private javax.swing.ButtonGroup buttonGroup4;
    private javax.swing.JComboBox dddCelCombobox;
    private javax.swing.JComboBox dddresComboBox;
    private javax.swing.JFormattedTextField nomeJtextField;
    // End of variables declaration//GEN-END:variables
}
